// 
// File:   utils.h
// Author: James
//
// Created on November 20, 2007, 8:07 PM
//

#ifndef _UTILS_H
#define	_UTILS_H

#include <iostream>

//user defined algorithm 
template <class T>
inline void print_elements(const T& container, 
                           const char* optcstr="",
                           const char sperator=' ')
{
    typename T::const_iterator pos;
    
    std::cout << optcstr;
    for(pos=container.begin();
        pos!=container.end();
        ++pos)
    {
        std::cout << *pos << sperator;
    }
    std::cout << std::endl;
};

template <class T>
inline void print_map_elements(const T& container, 
                           const char* optcstr="",
                           const char sperator=' ')
{
    typename T::const_iterator pos;
    
    std::cout << optcstr;
    for(pos=container.begin();
        pos!=container.end();
        ++pos)
    {
        std::cout << pos->second << sperator;
    }
    std::cout << std::endl;
};

template <class T>
inline void insert_elements(T& container, int first, int last)
{
    for (int i=first; i<=last; ++i)
    {
        container.insert(container.end(),i);
    }
};


#endif	/* _UTILS_H */

